package com.gec.system.Service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gec.model.pojo.TCategory;
import com.gec.system.Service.TCategoryService;
import com.gec.system.mapper.TCategoryMapper;
import com.gec.system.util.TCategoryHelper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class TCategoryServiceImpl extends ServiceImpl<TCategoryMapper, TCategory> implements TCategoryService {
    @Override
    public List<TCategory> findNodes() {
        // 获取所有数据
        List<TCategory> TCList = baseMapper.selectList(null);
        System.out.println("查找后集合大小："+TCList.size());
        // 转换数据格式
        List<TCategory> buildTree = TCategoryHelper.buildTree(TCList);

        return buildTree;

    }
}
